﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace WpfSnqkGasAnalysis
{
    /// <summary>
    /// 打印按钮显示控制。
    /// </summary>
    /// 创建时间：2022-12-9 16:12:46。作者：王浩力
    internal class Gas_analysisPrintBtnConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (int.TryParse(value.ToString(), out int o_step))
            {
                //如果是导出按钮
                if (parameter != null && System.Convert.ToString(parameter).Equals("export"))
                {
                    if (o_step == 4)
                    {
                        return System.Windows.Visibility.Visible;
                    }
                    else
                    {
                        return System.Windows.Visibility.Collapsed;
                    }
                }
               
                if (o_step == 1 || o_step == 2 || o_step == 4)
                {
                    return System.Windows.Visibility.Visible;
                }
              
                return System.Windows.Visibility.Collapsed;
            }
            else
            {
                return System.Windows.Visibility.Collapsed;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
